home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Buffers / ConstBuffer.cp < prev    next >
Encoding:
Text File  |  1997-06-28  |  615 b   |  35 lines  |  [TEXT/CWIE]

  1. // ConstBuffer.cp
  2.  
  3. #ifndef ConstBuffer_h
  4. #include "ConstBuffer.h"
  5. #endif
  6. #ifndef Buffer_h
  7. #include "Buffer.h"
  8. #endif
  9.  
  10. ConstBuffer::ConstBuffer( ConstData theSpace )
  11.   : space( theSpace ),
  12.      unused( theSpace )
  13.   {
  14.     Assert( !theSpace.Null() );
  15.   }
  16.  
  17. void ConstBuffer::Reset( ConstData theSpace )
  18.   {
  19.     Assert( !theSpace.Null() );
  20.     space = theSpace;
  21.     unused = theSpace;
  22.   }
  23.  
  24. void ConstBuffer::operator>>( Data target )
  25.   {
  26.     AdvanceMark( target << Unused() );
  27.   }
  28.  
  29. void ConstBuffer::operator>>( Buffer& target )
  30.   {
  31.     uint32 amount = target.Unused() << Unused();
  32.     AdvanceMark( amount );
  33.     target.AdvanceMark( amount );
  34.   }
  35.